(ns window
)
(import '(javax.swing JFrame JButton JLabel JPanel JTextField JComboBox JCheckBox JSeparator JRadioButton ButtonGroup)
        '(java.awt.event ActionListener)
        '(java.awt BorderLayout Dimension FlowLayout)
        '(java.awt GridLayout))

(defn window
  "Window used as the GUI for the URLyBird"
  [title]
  (let [frame (JFrame. title)
	maxContainer (JPanel. (GridLayout. 2 0))
	container (JPanel. (GridLayout. 0 2))
        search   (JButton. "Search")
        register (JButton. "Register")
        hotelL   (JLabel. "Hotel Name:" JLabel/CENTER)
        hotelF   (JTextField. 20)
        cityL    (JLabel. "City: " JLabel/CENTER)
        cityF    (JTextField. 20)
        occupL   (JLabel. "Maximum Occupancy of this room:" JLabel/CENTER)
        occupP   (JPanel. (FlowLayout. ))
	occupB1  (JRadioButton. "1")
	occupB2  (JRadioButton. "2")
	occupB4  (JRadioButton. "4")
	occupB6  (JRadioButton. "6")
	occupB6_more (JRadioButton. "+6")
	buttonG  (ButtonGroup. )
        smokingL (JLabel. "Smoking Room?:" JLabel/CENTER)
	smokingF (JCheckBox. "Yes")
        priceL   (JLabel. "Price per night(USD)" JLabel/CENTER)
	priceP   (JPanel. (FlowLayout. ))
	priceF   (JComboBox. )
        dateL    (JLabel. "Date available" JLabel/CENTER)
	dateP    (JPanel. (FlowLayout. ))
	mmCombo (JComboBox. )
	yyCombo (JComboBox. )
	ddCombo (JComboBox. )
        mmL      (JLabel. "mm" JLabel/CENTER)
        yyL      (JLabel. "yyyy" JLabel/CENTER)
        ddL      (JLabel. "dd" JLabel/CENTER)
        customL  (JLabel. "Customer holding this record:" JLabel/CENTER)
        customF  (JTextField. 20)

       ]
    (.setDefaultCloseOperation frame JFrame/EXIT_ON_CLOSE)
    (.add maxContainer container)
    (.add maxContainer (JLabel. " " JLabel/CENTER))
    (.add frame BorderLayout/CENTER maxContainer)
    (.add frame BorderLayout/NORTH (JLabel. "Search Hotels" JLabel/CENTER))
    (.add frame BorderLayout/EAST search)
    (doto priceF
      (.addItem "precio1")
      (.addItem "precio2")
      (.addItem "precio3")
     )
    (doto mmCombo
      (.addItem "01")
      (.addItem "02")
      (.addItem "03")
      (.addItem "04")
      (.addItem "05")
      (.addItem "06")
      (.addItem "07")
      (.addItem "08")
      (.addItem "09")
      (.addItem "10")
      (.addItem "11")
      (.addItem "12")
    )
    (doto yyCombo
      (.addItem "2002")
      (.addItem "2003")
      (.addItem "2004")
      (.addItem "2005")
      (.addItem "2006")
      (.addItem "2007")
      (.addItem "2008")
      (.addItem "2009")
      (.addItem "2010")
      (.addItem "2011")
    )
    (doto ddCombo
    )
    (.add dateP yyL)
    (.add dateP yyCombo)
    (.add dateP mmL)
    (.add dateP mmCombo)
    (.add dateP ddL)
    (.add dateP ddCombo)
    (.add buttonG occupB1)
    (.add buttonG occupB2)
    (.add buttonG occupB4)
    (.add buttonG occupB6)
    (.add buttonG occupB6_more)
    (.add occupP occupB1)
    (.add occupP occupB2)
    (.add occupP occupB4)
    (.add occupP occupB6)
    (.add occupP occupB6_more)
    (.add container hotelL)
    (.add container hotelF)
    (.add container (JSeparator. ))
    (.add container (JSeparator. ))
    (.add container cityL)
    (.add container cityF)
    (.add container occupL)
    (.add container occupP)
    (.add container smokingL)
    (.add container smokingF)
    (.add container priceL)
    (.add container priceF)
    (.add container dateL)
    (.add container dateP)
    (.add container customL)
    (.add container customF)
    (.pack frame)
    (.setVisible frame true)))

(window "URLyBird")